from urllib.parse import urlparse, urlunparse, urlsplit, urlunsplit

result=urlparse('www.baidu.com/index.html;user?id=5#comment',
                scheme="https", allow_fragments=False)
print(type(result), result)


data=['http', 'www.baidu.com', 'index.html', 'user', 'a=6', 'comment']
result = urlunparse(data)
newResultPath = urlsplit(result)
print(newResultPath, newResultPath.scheme, newResultPath[0])
newUrl = urlunsplit(newResultPath)
print(newUrl)
